#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
typedef long long LL;
const int N = 3e5 + 10;
int arr[N];
const int mod = 1e9 + 7;
int n, m, k;
priority_queue<int, vector<int>, greater<int>>q2;
priority_queue<int>q1;
int main()
{
	cin >> n >> m >> k;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		q1.push(x);
	}
	for (int i = 0; i < k; i++) {
		int t = q1.top();
		q1.pop();
		q1.push(t - m);
	}
	for (int i = 0; i < n; i++) {
		int t = q1.top();
		q1.pop();
		q2.push(t);
	}
	for (int i = 0; i < k; i++) {
		int t = q2.top();
		q2.pop();
		q2.push(t + m);
	}
	LL ans = 1;
	while (q2.size()) {
		int t = q2.top();
		ans = ans * t % mod;
		q2.pop();
	}
	cout << ans << endl;
	return 0;
}